package cn.jly.spring.annotation.ioc.config;

import cn.jly.spring.annotation.ioc.dao.BookRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author lanyangji
 * @description 测试自动装配的配置类
 * @date 2020/11/13 上午 10:44
 */
@Configuration
@ComponentScan(basePackages = {"cn.jly.spring.annotation.ioc.controller",
        "cn.jly.spring.annotation.ioc.dao", "cn.jly.spring.annotation.ioc.service"})
public class MainConfigAutowired {

    // @Primary
    @Bean("bookRepository2")
    public BookRepository bookRepository() {
        final BookRepository bookRepository = new BookRepository();
        bookRepository.setLabel("2");
        return bookRepository;
    }
}
